<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title></title>
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <script type="text/javascript" src="{$resource_basic}/js/jquery.min.js"></script>
  

</head>

<body>
    
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
//分享

wx.config({
    debug: false,
    appId: '{$signPackage["appId"]}',
    timestamp: {$signPackage["timestamp"]},
    nonceStr: '{$signPackage["nonceStr"]}',
    signature: '{$signPackage["signature"]}',
    jsApiList: [
      // 所有要调用的 API 都要加到这个列表中
      'scanQRCode'
    ]
});


wx.ready(function () {
// 在这里调用 API
wx.scanQRCode({
      needResult: 1,
      desc: 'scanQRCode',
      success: function (res) {
          var barcode = res.resultStr;
          
          var barcode_chk = barcode.substr(0,6);
          
          if(barcode_chk == "EAN_13")
          {
              var barcode_true = barcode.substr(7,barcode.length);
               window.location.href="{:U('M/Scan/result')}"+"?barcode="+barcode_true;
              
          }
          else
          {
              alert("暂无该条码信息");
              top.location.reload();
          }
          

      }
    });


});

</script>

</body>
</html>